import datetime
from urllib.parse import urlparse
from fastapi.responses import ORJSONResponse
from fastapi.routing import APIRouter
from logs.settings import logger
from views.crypto.func.utils import *


router = APIRouter(
    prefix="/api",
    tags=["crypto"],
    default_response_class=ORJSONResponse
)


@router.post('/crypto/encode', summary='请求加密', description='', )
async def ApiEncode(query: dict):
    data = encode(**query)
    return {"data": data}


@router.post('/crypto/decode', summary='请求解密', description='', )
async def ApiDecode(query: dict):
    data = decode(**query)
    return {"data": data}
